import { createStore,combineReducers} from 'redux'
const defaultState ={
    count:0,
    age:20,
    username:'zhangsan'
}

const reducer1 = function(state = defaultState,action){
      // 分支判断
      if(action.type === "mod_count"){
        return {...state,count:state.count + action.payl}
    }


    return state;
}
const reducer2 = function(state = defaultState,action){
    // 分支判断
    if(action.type === "mod_age"){
      return {...state,age:state.age + action.payl}
  }

  return state;
}

const reducers = combineReducers({reducer1,reducer2})

const store = createStore(reducers,window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__())
export default store
